<?php
    class ElementMain extends Element {
        public function Render() {
            global $page;
            
            // attach global scripts and stylesheets here
            // $page->AttachStylesheet( 'css/main.css' );
            // $page->AttachStylesheet( 'js/main.js' );
			$page->AttachScript( 'js/main.js' );
			$page->AttachScript( 'js/modal.js' );
            $page->AttachScript( 'js/coala.js' );
			$page->AttachScript( 'js/animations.js' );
            $page->AttachScript( 'js/table/create.js' ); // high priority (before js/table/select.js)
            $page->AttachScript( 'js/server.js' );
            $page->AttachScript( 'js/database.js' );
            $page->AttachScript( 'js/postinfo.js' );
            $page->AttachScript( 'js/calendar.js' );
            $page->AttachScript( 'js/row.js' );
            $page->AttachScript( 'js/terminal.js' );
            $page->AttachScript( 'js/sql.js' );
            $page->AttachScript( 'js/table/select.js' );
            $page->AttachScript( 'js/metadata.js' );
            $page->AttachScript( 'js/login.js' );
            $page->AttachScript( 'js/topbar.js' );

            $page->AttachStylesheet( 'css/main.css' );
            $page->AttachStylesheet( 'css/topbar.css' );
            $page->AttachStylesheet( 'css/resultset.css' );
            $page->AttachStylesheet( 'css/postinfo.css' );
            $page->AttachStylesheet( 'css/table/browse.css' );
            $page->AttachStylesheet( 'css/table/create.css' );
            $page->AttachStylesheet( 'css/modal/main.css' );
            $page->AttachStylesheet( 'css/modal/logon.css' );
            $page->AttachStylesheet( 'css/modal/terminal.css' );
            $page->AttachStylesheet( 'css/modal/createtable.css' );
            $page->AttachStylesheet( 'css/tab.css' );

            ob_start();
            $res = MasterElement();
            $master = ob_get_clean();
            if ( $res === false ) { // If the page requested is not in the pages available by pagemap
                Element( '404' );
            }
            else {
                ?><div id="content"><?php
                echo $master;
                ?></div><?php
            }

            $page->SetTitle( $page->Title() . " - Baboo" );

            // pass
            return $res;
        }
    }
?>
